home *** CD-ROM | disk | FTP | other *** search
/ Robotics & Artificial Int…3 (Professional Edition) / Robotics & Artificial Intelligence Tools 2003 (Professional Edition).iso / neural network tool and application / nsinstall.exe / data1.cab / DllSys_Files / SYNAPSE / SYNAPSE.C < prev   
Encoding:
C/C++ Source or Header  |  2002-03-08  |  1.6 KB  |  53 lines

  1. // Dynamic link library implementation of NeuroSolutions Synapse component 
  2.  
  3. #include "NSDLL.h"
  4.  
  5. /*************************************************/
  6. /* Macros to access the PE layers in matrix form */
  7.  
  8. #define in(i,j)        input[j+i*inCols]
  9. #define out(i,j)    output[j+i*inCols]
  10.  
  11. /***********************************/
  12. /* Forward activation of component */
  13.  
  14. __declspec(dllexport) void performSynapse(
  15.     DLLData *instance,    // Pointer to instance data (may be NULL)
  16.     NSFloat    *input,     // Pointer to the input layer of processing elements (PEs)
  17.     int     inRows,        // Number of rows of PEs in the input layer
  18.     int     inCols,        // Number of columns of PEs in the input layer
  19.     NSFloat    *output,     // Pointer to the output layer
  20.     int     outRows,    // Number of rows of PEs in the output layer
  21.     int     outCols        // Number of columns of PEs in the output layer
  22.     )
  23. {
  24.     int    i,
  25.         inCount=inRows*inCols,
  26.         outCount=outRows*outCols,
  27.         count = inCount<outCount? inCount: outCount;
  28.  
  29.     for (i=0; i<count; i++)
  30.         output[i] += input[i]; 
  31. }
  32.  
  33. /******************************************/
  34. /* Management of instance data (OPTIONAL) */
  35. /*
  36. __declspec(dllexport) DLLData *allocSynapse(
  37.     DLLData    *oldInstance,    // Pointer to the last instance if reallocating
  38.     int     inRows,            // Number of rows of PEs in the input layer
  39.     int     inCols,            // Number of columns of PEs in the input layer
  40.     int     outRows,        // Number of rows of PEs in the output layer
  41.     int     outCols            // Number of columns of PEs in the output layer
  42.     )
  43. {
  44.     DLLData *instance = allocDLLInstance(oldInstance);
  45.     return instance;
  46. }
  47.  
  48. __declspec(dllexport) void freeSynapse(DLLData *instance)
  49. {
  50.     freeDLLInstance(instance);
  51. }
  52. */
  53.